package org.mysfit.ctp4j.infra.enums;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

/**
 * 操作系统类型枚举
 * 
 * @author long.gf
 *
 */
public enum PloyEnum {

	POLY_A("POLY_A","55 - 15",0,1,"POLY_A"),
	POLY_B("POLY_B","55 - 05",0,1,"POLY_B")
	;

	private String polyNo;
	
	private String polyName;
	
	private int status;
	
	private int level;
	
	private String desc;
	
	private PloyEnum(String polyNo, String polyName, int status, int level, String desc) {
		this.polyNo = polyNo;
		this.polyName = polyName;
		this.status = status;
		this.level = level;
		this.desc = desc;
	}


	public String getPolyNo() {
		return polyNo;
	}


	public void setPolyNo(String polyNo) {
		this.polyNo = polyNo;
	}


	public String getPolyName() {
		return polyName;
	}


	public void setPolyName(String polyName) {
		this.polyName = polyName;
	}


	public int getStatus() {
		return status;
	}


	public void setStatus(int status) {
		this.status = status;
	}


	public String getDesc() {
		return desc;
	}


	public void setDesc(String desc) {
		this.desc = desc;
	}


	public int getLevel() {
		return level;
	}


	public void setLevel(int level) {
		this.level = level;
	}
	
	public static List<PloyEnum> getEffectuveList() {
		List<PloyEnum> polyList = new ArrayList<PloyEnum>();
		PloyEnum[] polys = PloyEnum.values();
		Arrays.sort(polys, new Comparator<PloyEnum>() {
			@Override
			public int compare(PloyEnum o1, PloyEnum o2) {
				return o2.getLevel() - o1.getLevel();
			}
		});
		for (PloyEnum en : polys) {
			if(en.getStatus() == 1) {
				polyList.add(en);
			}
		}
		return polyList;
	}
	
}
